IF EXISTS(SELECT * FROM SYSOBJECTS WHERE name = 'Users' AND xtype = 'U')
BEGIN
	DROP TABLE Users
END
GO

IF NOT EXISTS(SELECT * FROM SYSOBJECTS WHERE name = 'Users' AND xtype = 'U')
BEGIN
	CREATE TABLE Users
	(
		UserId			int not null IDENTITY(1,1),
		UserLogin		varchar(50),
		UserPassword	varchar(100),
		UserAlcada		int not null,
		ReferenceId		varchar(200) not null
	)
END
GO

IF NOT EXISTS(SELECT * FROM SYSOBJECTS WHERE name = 'pk_UserId' AND xtype = 'PK')
BEGIN
	ALTER TABLE Users
	ADD CONSTRAINT pk_UserId PRIMARY KEY ([UserId])
END
GO